#ifndef _SCHED_H_
#define _SCHED_H_

#include <defs.h>
#include <td.h>
#include <pq.h>

typedef struct __sched {
  td tasks[MAX_TASKS];
  // NOTE: We allocate an additional "critical queue" above the MAX_PRI
  // normal priority queues. Tasks cannot be created at this priority level;
  // rather, they are placed there by the event handlers to ensure that
  // event listeners execute as soon as possible.
  pq queues[MAX_PRI+1];
  // NOTE: We only allow one task to wait on each possible event. If another
  // task requests to wait on the event, it will be refused.
  int waiters[EVENT_MAX];
  int next_task_id;
} sched;

#endif
